# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=hdrhistogram-c
_projname=HdrHistogram_c
pkgver=0.11.8
pkgrel=1
pkgdesc="High Dynamic Range (HDR) Histogram in C"
url="https://github.com/HdrHistogram/HdrHistogram_c"
arch="all"
license="BSD-2-Clause"
makedepends="cmake samurai zlib-dev"
subpackages="$pkgname-static $pkgname-dev"
source="https://github.com/HdrHistogram/HdrHistogram_c/archive/$pkgver/$_projname-$pkgver.tar.gz"
builddir="$srcdir/$_projname-$pkgver"

build() {
	cmake -G Ninja -B build \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_VERBOSE_MAKEFILE=ON \
		-DBUILD_SHARED_LIBS=ON \
		-DHDR_HISTOGRAM_BUILD_PROGRAMS=True
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	# Don't package tests and example programs.
	rm -rf "$pkgdir"/usr/bin
}

sha512sums="
2ede4b8412c4f0070d555515498e163397de5edebe7560eaea13adcb95a52b7fea99686aed06bbca0c6e8afdf65715483c3889d750f6b5b727bcf43c4fbe18d4  HdrHistogram_c-0.11.8.tar.gz
"
